property defaultPlist : "com.rtech.prepress"
property masterPlist : "Prepress Master Preferences"

on will quit theObject
	(*Add your script here.*)
end will quit

on will finish launching theObject
	
	
	
	
	try
		set databaseExist to do shell script "defaults read" & quoted form of defaultPlist & " 'Database Exists' "
	on error
		display dialog "A base de dados não existe. 
Deseja criá-la?" buttons {"Sim", "Não"} default button 1 with icon 2
		if button returned of the result = "Sim" then
			call method "makeKeyAndOrderFront:" of object window "criarDB"
			if contents of text field "databaseName" of window "criarDB" = "" then
				my activarBotoes("dataBaseLocBotao")
				my activarBotoes("dataBaseNameBotao")
				my activarBotoes("imagesLocBotao")
				my activarBotoes("imagesPlanosLocBotao")
				my activarBotoes("criarBaseDeDados")
			end if
		end if
	end try
	
	
	-- tell my pth to display dialog pt
	
	
end will finish launching



on activarBotoes(botao)
	set enabled of button botao of window "criarDB" to true
end activarBotoes

